<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分账撤销管理</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/animate.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/style.min.css?v=4.1.0" rel="stylesheet">
    <style type="text/css">

    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>分账撤销管理</h5>
        </div>
        <div class="ibox-content">
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="example-wrap">
                        <!-- start toolbar -->
                        <div class="col-sm-12">
                            <form class="form-horizontal" role="form" id="queryorderForm" autocomplete="off">
                                <div class="row">
                                 	<div class="col-sm-4">
                                        <div class="form-group">
                                            <label class="col-sm-4 control-label">撤销时间</label>
                                            <div class="col-sm-8">
                                                <input type="text" class="form-control" placeholder="撤销时间"  id="startTime" name="reReqTime">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-sm-4 " >
                                        <div class="form-group">
                                            <label class="col-sm-4 control-label" >分账人名称</label>
                                            <div class="col-sm-8">
                                                <input type="text" class="form-control" placeholder="企业名称"  id="cpName" name="cutPayCost.cpName">
                                            </div>
                                           
                                        </div>
                                    </div>
                                    <div class="col-sm-4">
                                    	<button type="button" class="btn btn-primary" id="queryRevokeBtn">
                                            <span class="glyphicon glyphicon-search" aria-hidden="true"></span> 查询
                                        </button>
                                        <button type="button" class="btn btn-info" id="" onclick="location.reload();">
                                            <span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> 刷新
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <!-- end toolbar -->
                        <div class="example">
                            <table id="revokeTab" class="table" data-click-to-select="true" data-mobile-responsive="true">
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- End Panel Other -->
<script src="${pageContext.request.contextPath}/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${pageContext.request.contextPath}/js/content.min.js?v=1.0.0"></script>
<script src="${pageContext.request.contextPath}/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="${pageContext.request.contextPath}/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="${pageContext.request.contextPath}/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="${pageContext.request.contextPath}/js/plugins/layer/layer.min.js"></script>
 <script src="${pageContext.request.contextPath}/laydate5.0.7/laydate.js"></script>
<script src="${pageContext.request.contextPath}/js/public/ttbj-core.js"></script>
<script type="text/javascript">
var $table = $("#revokeTab");
$(function () {
	//时间控件
	 laydate.render({
    	elem: '#startTime',
    	type: 'datetime'
    });
    initTable();
    //条件查询
    $("#queryRevokeBtn").click(function () {
        $table.bootstrapTable('refresh');	 //使用post提交
    });
   
});

function initTable() {
    $table.bootstrapTable({
    	dataType: "json",
        showColumns: true,
        singleSelect : true,
        pagination: true, //分页
        striped: true,
        cache: false,	//是否使用缓存，默认是true
        pageSize: 10,
        pageNumber: 1,
        queryParamsType: 'limit',
        smartDisplay: true,
        sidePagination: "server",
        method: "post",	//使用post提交
        queryParams: queryParams,
        url: '../cprevoke/getCutPayRevokeByPage.htm',
        contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
        columns: [
            {
                title: "序号",
                align: 'center',
                formatter:function(value,row,index){
                    return index + 1;
                }
            },
            {
                title: "撤销分账订单号",
                field: "reOrderNo",
                align: 'center',
                valign: 'middle'
            },
            {
            	title: "分账订单号",
                field: "reTransNo",
                align: 'center',
                valign: 'middle'
            },
            {
            	title: "撤销分账金额",
                field: "reAmount",
                align: 'center',
                valign: 'middle'
            },
            {
                title: "撤销分账状态",
                field: "reStatus",
                align: 'center',
                valign: 'middle',
                formatter: function(value, row, index){
                    var reStatus = "-";
                    if(row.reStatus == 0){
                    	reStatus = '<span style="color:#ed5565;">失败</span>';
                    }else if(row.reStatus == 1){
                    	reStatus ='<span style="color:green;">成功</span>';
                    }
                    return reStatus;
                }
            },
            {
            	title: "撤销分账描述",
                field: "reRetInfo",
                align: 'center',
                valign: 'middle'
            },
            {
                title: "撤销分账应答代码",
                field: "reRetCode",
                align: 'center',
                valign: 'middle'
            },
            {
                title: "撤销时间",
                field: "reReqTime",
                align: 'center',
                valign: 'middle'
            },
            {
                title: "分账人名称",
                field: "cutPayCost.cpName",
                align: 'center',
                valign: 'middle'
            },
            {
                title: "分账人编号",
                field: "cutPayCost.cpNum",
                align: 'center',
                valign: 'middle'
            },
            {
                title: "分账人类型",
                field: "cutPayCost.cpType",
                align: 'center',
                formatter: function(value, row, index){
                    var cpType = "-";
                    if(row.cutPayCost.cpType == "A"){
                    	cpType = '<span style="color:#ed5565;">平台</span>';
                    }else if(row.cutPayCost.cpType == "B"){
                    	cpType ='<span style="color:green;">司机</span>';
                    }
                    else if(row.cutPayCost.cpType == "C"){
                    	cpType ='<span style="color:#E8F2FE;">企业</span>';
                    }
                    return cpType;
                }
            }
        ],
        onClickRow: function(row, $element, field){	//当点击某一行时，该行背景颜色改变
        	var trObj = $($element[0]);
        	var dataIndex = trObj.attr('data-index');
        	$("tr[data-index != '" + dataIndex + "']").removeAttr('style');
        	trObj.attr('style', 'background: #B4EEB4');
        }
    });
}
function queryParams(queryParamsType){
	var temp = {
		'limit': queryParamsType.limit,   //页面大小
		'offset': queryParamsType.offset,  //页码
		'reReqTime': $.trim($('#startTime').val()),
		'cutPayCost.cpName': $.trim($('#cpName').val()), 
	};
	return temp;
}
</script>
</body>
</html>
